package com.hmall.config;

import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;


/**
 * @Author zhoutao
 * @Description // c3p0配置
 * @Date 2018/11/2 9:25
 * @Param
 * @return
 **/

@Configuration
public class DatasourceConfiguration {
     
     @Bean(name = "dataSource")
     @Qualifier(value = "dataSource")
     @Primary
     @ConfigurationProperties(prefix = "spring.datasource")
     public DataSource dataSource(){
      return DataSourceBuilder.create().type(com.mchange.v2.c3p0.ComboPooledDataSource.class).build();
     }
}
